package com.c2c.converter;

import com.c2c.po.enums.impl.OrdersState;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class OrderStateConverter implements Converter<Integer, OrdersState> {


    @Override
    public OrdersState convert(Integer integer) {
        for (OrdersState ordersState : OrdersState.values()){
            if (ordersState.getCode() == integer){
                return ordersState;
            }
        }
        return null;
    }
}
